// pages/play/play.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    goodsList:[{
      imgSrc:'../../images/materials/recommendation1.png',
      title:'传统木版滩头年画',
      desc:'使用传统木版工艺制作的印有滩头年画的装饰物',
      price:69,
      sales:28
    },{
      imgSrc:'../../images/materials/recommendation16.png',
      title:'马克杯',
      desc:'滩头年画周边马克杯',
      price:29,
      sales:120
    },{
      imgSrc:'../../images/materials/recommendation2.png',
      title:'徽章',
      desc:'滩头年画周边徽章',
      price:10,
      sales:226
    },{
      imgSrc:'../../images/materials/recommendation3.png',
      title:'帆布袋',
      desc:'滩头年画周边帆布袋',
      price:29,
      sales:59
    },{
      imgSrc:'../../images/materials/recommendation10.png',
      title:'三花茶',
      desc:'茉莉玫瑰金银花美容养颜茶包',
      price:19.9,
      sales:17
    },{
      imgSrc:'../../images/materials/recommendation11.png',
      title:'隆回麦芽糖',
      desc:'香甜可口，老少皆宜',
      price:8.9,
      sales:34
    },{
      imgSrc:'../../images/materials/recommendation12.png',
      title:'隆回糯米糍粑',
      desc:'软软糯糯',
      price:4.5,
      sales:15
    },{
      imgSrc:'../../images/materials/recommendation15.png',
      title:'龙牙百合',
      desc:'隆回当地特色美食',
      price:9.9,
      sales:12
    },{
      imgSrc:'../../images/materials/recommendation5.png',
      title:'手机壳',
      desc:'滩头年画周边手机壳',
      price:19,
      sales:26
    },{
      imgSrc:'../../images/materials/recommendation6.png',
      title:'食品包装袋',
      desc:'滩头年画周边包装袋',
      price:4.9,
      sales:36
    },{
      imgSrc:'../../images/materials/recommendation7.png',
      title:'奶茶杯',
      desc:'滩头年画周边奶茶杯',
      price:2.9,
      sales:100
    },{
      imgSrc:'../../images/materials/recommendation8.png',
      title:'口罩',
      desc:'滩头年画周边口罩',
      price:0.3,
      sales:50
    },{
      imgSrc:'../../images/materials/recommendation4.png',
      title:'红包',
      desc:'滩头年画周边红包',
      price:3,
      sales:9
    },{
      imgSrc:'../../images/materials/recommendation9.png',
      title:'奶茶包',
      desc:'传统中式药材奶茶包',
      price:19.9,
      sales:26
    },{
      imgSrc:'../../images/materials/recommendation13.png',
      title:'猪血丸子',
      desc:'隆回当地特色美食',
      price:29.9,
      sales:13
    },{
      imgSrc:'../../images/materials/recommendation14.png',
      title:'腰带柿',
      desc:'隆回当地特色美食',
      price:19.9,
      sales:21
    },],
    leftList:[],
    rightList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.twoSidesCompoute();
  },
  // 计算好物推荐的两栏各放几张照片
  twoSidesCompoute(){
    var goodsNum = this.data.goodsList.length;
    this.setData({
      leftList:this.data.goodsList.slice(0,Math.trunc(goodsNum/2)),
      rightList:this.data.goodsList.slice(Math.trunc(goodsNum/2))
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})